<template>
    <div class="adminleft" id="daminleft">
        <ul>
            <li class="li-col logo"><img src="../../assets/img/boyellLogo.png" alt=""></li>
            <li class="li-col">
                <router-link to='../program/programList'>
                    <img class="nav-icon-house" src="../../assets/img/icon-house.png" alt="">
                    小程序管理
                </router-link>
            </li>
            <el-menu class="el-menu-vertical-demo" unique-opened>
                <el-submenu :index="'_'+index"  v-for="(item,index) in activeNames" :key="index">
                    <template slot="title">
                        <img class="nav-icon" :src='item.icon1' alt="">
                        <img class="nav-icon-active" :src='item.icon2' alt="">
                        <span>{{item.name}}</span>
                    </template>
                    <el-menu-item-group v-for="(items,indexs) in item.childMenu" :key="indexs">
                        <el-menu-item :index="indexs+'-'+indexs" class="l-router" style="padding:0;">
                            <router-link :to="'/template/'+items.path">
                                {{items.name}}
                            </router-link>
                        </el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </ul>
    </div>
</template>
<script>
import Vue from 'vue'
// import { Collapse, CollapseItem } from 'vant';
// Vue.use(Collapse).use(CollapseItem);
export default {
  data:function(){
    return {
      activeNames: []
    };
  },
  mounted:function(){
    let url = 'index/menu'
    this.$axios.getAddressJson(url)
    .then(res=> {
        // console.log(res.data)
        this.activeNames = res.data.filter(function (item) {
            return item
        })
    })
    .catch(res=>{
        alert('发生未知错误')
    })

  },

};
</script>
